<template>
  <a-card :bordered="false" v-show='isFacClassroomListShow'>
    <!-- table区域-begin -->
    <div>
      <a-table
        ref="table"
        size="middle"
        :scroll="{x:true}"
        bordered
        rowKey="id"
        :columns="columns"
        :dataSource="dataSource"
        :pagination="ipagination"
        :loading="loading"
        :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
        class="j-table-force-nowrap"
        @change="handleTableChange">

        <template slot="htmlSlot" slot-scope="text">
          <div v-html="text"></div>
        </template>
        <template slot="imgSlot" slot-scope="text">
          <span v-if="!text" style="font-size: 12px;font-style: italic;">无图片</span>
          <img v-else :src="getImgView(text)" height="25px" alt="" style="max-width:80px;font-size: 12px;font-style: italic;"/>
        </template>
        <template slot="fileSlot" slot-scope="text">
          <span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span>
          <a-button
            v-else
            :ghost="true"
            type="primary"
            icon="download"
            size="small"
            @click="downloadFile(text)">
            下载
          </a-button>
        </template>

        <span slot="action" slot-scope="text, record">
          <a-divider type="vertical" />
        </span>

      </a-table>
    </div>
  </a-card>
</template>

<script>

import '@/assets/less/TableExpand.less'
import { mixinDevice } from '@/utils/mixin'
import { JeecgListMixin } from '@/mixins/JeecgListMixin'

export default {
  name: 'FacClassroomListComp',
  mixins:[JeecgListMixin, mixinDevice],
  components: {
  },
  props:{
    isFacClassroomListShow: false,
    classId: {
      type: String,
      default: ''
    }
  },
  watch:{
    f:{
      immediate: true,
      handler(){
        if(this.classId){
          this.queryParam.classId = this.classId;
          this.loadData();
        }
      }
    }
  },
  data () {
    return {
      description: 'fac_classroom管理页面',
      // 表头
      columns: [
        {
          title:'教室编号',
          align:"center",
          dataIndex: 'classroomCode'
        },
        {
          title:'教室名称',
          align:"center",
          dataIndex: 'classroomName'
        },
        {
          title:'教室别名',
          align:"center",
          dataIndex: 'classroomNickname'
        },
        {
          title:'用途',
          align:"center",
          dataIndex: 'classroomUsage'
        },
        {
          title:'容纳学生数量',
          align:"center",
          dataIndex: 'classroomStudentCapacity'
        },
        {
          title:'容纳班级数量',
          align:"center",
          dataIndex: 'classroomClassesCapacity'
        },
        {
          title:'描述',
          align:"center",
          dataIndex: 'classroomIntroduce'
        },
        {
          title:'所属建筑',
          align:"center",
          dataIndex: 'buildingName'
        },
        {
          title:'教室面积',
          align:"center",
          dataIndex: 'classroomArea'
        },
        {
          title:'教室类型',
          align:"center",
          dataIndex: 'classroomType_dictText'
        },

        {
          title:'是否可用',
          align:"center",
          dataIndex: 'classroomIzOpen_dictText'
        },
        {
          title:'教室结构',
          align:"center",
          dataIndex: 'classroomStructure'
        },

        {
          title:'排序',
          align:"center",
          dataIndex: 'classroomOrder'
        },
      ],
      url: {
        list: "/classroom/facClassroom/voListAll",
        exportXlsUrl: "/classroom/facClassroom/exportXls",

      },
      dictOptions:{},
      superFieldList:[],
      disableMixinCreated: true,
    }
  },
  created() {
  },
  mounted() {
    this.$bus.$on('isFacClassroomListShow',(val)=>{
      console.log('监听收到班级信息ID'+val);
      console.log(val);
      this.queryParam.id = val.returnClassroomId;
      this.loadData();
    })
  },
  computed: {
    importExcelUrl: function(){
      return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
    },
  },
  methods: {

  }
}
</script>
<style scoped>
@import '~@assets/less/common.less';
</style>